public class SpotAnimation {
	public static int total;
	public static SpotAnimation[] spotAnims;
	public int id;
	public int anInt556;
	public int anInt557 = -1;
	public Sequence sequence;
	public int[] srcColors = new int[6];
	public int[] destColors = new int[6];
	public int anInt561 = 128;
	public int anInt562 = 128;
	public int anInt563;
	public int anInt564;
	public int anInt565;
	public static Cache aCache_566 = new Cache(30);

	public static void getValues(Archive archive) {
		Packet packet = new Packet(archive.method154(
			"spotanim.dat", null));
		SpotAnimation.total = packet.getUShort();
		if (SpotAnimation.spotAnims == null) {
			SpotAnimation.spotAnims = new SpotAnimation[SpotAnimation.total];
		}
		for (int loopId = 0; loopId < SpotAnimation.total; loopId++) {
			if (SpotAnimation.spotAnims[loopId] == null) {
				SpotAnimation.spotAnims[loopId] = new SpotAnimation();
			}
			SpotAnimation.spotAnims[loopId].id = loopId;
			SpotAnimation.spotAnims[loopId].method306(packet);
		}
	}

	public void method306(Packet packet) {
		for (;;) {
			int i_1_ = packet.getUByte();
			if (i_1_ == 0) {
				break;
			}
			if (i_1_ == 1) {
				anInt556 = packet.getUShort();
			} else if (i_1_ == 2) {
				anInt557 = packet.getUShort();
				if (Sequence.sequences != null) {
					sequence = Sequence.sequences[anInt557];
				}
			} else if (i_1_ == 4) {
				anInt561 = packet.getUShort();
			} else if (i_1_ == 5) {
				anInt562 = packet.getUShort();
			} else if (i_1_ == 6) {
				anInt563 = packet.getUShort();
			} else if (i_1_ == 7) {
				anInt564 = packet.getUByte();
			} else if (i_1_ == 8) {
				anInt565 = packet.getUByte();
			} else if (i_1_ >= 40 && i_1_ < 50) {
				srcColors[i_1_ - 40] = packet.getUShort();
			} else if (i_1_ >= 50 && i_1_ < 60) {
				destColors[i_1_ - 50] = packet.getUShort();
			} else {
				System.out.println("Error unrecognised spotanim config code: " + i_1_);
			}
		}
	}

	public Model method307() {
		Model model = (Model) SpotAnimation.aCache_566
			.method345(id);
		if (model != null) {
			return model;
		}
		model = Model.method588(anInt556);
		if (model == null) {
			return null;
		}
		for (int i = 0; i < 6; i++) {
			if (srcColors[0] != 0) {
				model.method602(srcColors[i], destColors[i]);
			}
		}
		SpotAnimation.aCache_566.method346(model, id);
		return model;
	}
}
